130 PRINT "FILLING ARRAY, PLEASE WAIT";: POKE 34,1: FOR X = 1 TO 1000:ARRAY(X) = ARRAY(X -1) + INT(10 * RND(1) +1): PRINT ".";: NEXT X:X = X -1: TEXT : HOME
140 REM PRINT MENU
150 PRINT TAB( 13)"SEARCH SAMPLER": PRINT TAB( 19)"BY": PRINT TAB( 10)"ANTONIO DE PASQUALE": PRINT TAB( 2)"COPYRIGHT(C) 1989 MINDCRAFT PUBL CORP": FOR Y = 1 TO 40: PRINT CHR$(95);: NEXT Y: PRINT
160 PRINT "THIS PROGRAM CURRENTLY CONTAINS AN ARRAY";: PRINT "WITH ";: INVERSE : PRINT X;: NORMAL : PRINT " VALUES RANGING FROM ";: INVERSE : PRINT ARRAY(1);: NORMAL : PRINT " TO ";: INVERSE : PRINT ARRAY(X): NORMAL : PRINT
170 VTAB 9: HTAB 1: PRINT "PLEASE CHOOSE ONE OF THE FOLLOWING:": PRINT : PRINT " 1. CONDUCT A LINEAR SEARCH": PRINT " 2. CONDUCT A BINARY SEARCH": PRINT " 3. EXIT THIS PROGRAM": PRINT
180 VTAB 15: HTAB 1: CALL -958: PRINT "ENTER CHOICE: ";: POKE -16368,0: GET K$: ON (K$ < >"1" AND K$ < >"2" AND K$ < >"3" AND K$ < > CHR$(27)) GOTO 180: IF K$ = CHR$(27) THEN K$ = "3"
190 PRINT K$: IF K$ = "3" THEN PRINT : PRINT "QUIT, REALLY? (";: INVERSE : PRINT "Y/N";: NORMAL : PRINT "> ";: GET K$: ON (K$ < >"Y" AND K$ < > CHR$(121)) GOTO 180: TEXT : HOME : END : REM HANDLE END OF PROGRAM
240 GET K$: ON (K$ = CHR$(27) AND LL = 0) GOTO 180: ON (K$ = CHR$(32) OR K$ = CHR$(21)) GOTO 240: ON (K$ = CHR$(8) AND LL = 0) GOTO 240: IF K$ = CHR$(8) THEN LL = LL -1:N$ = MID$ (N$,1,LL): PRINT CHR$(8);" "; CHR$(8);: GOTO 240
250 ON (K$ = CHR$(27) AND LL = 0) GOTO 180: ON (K$ = CHR$(27) AND LL < >0) GOTO 230: ON (K$ = CHR$(13) AND LL = 0) GOTO 240: ON (K$ = CHR$(13) AND LL < >0) GOTO 260: PRINT K$;:N$ = N$ +K$:LL = LL +1: GOTO 240
260 PRINT : ON (N$ < > STR$( VAL(N$))) GOTO 230:N = VAL(N$):NT = 1: FOR INDEX = 1 TO X: ON (ARRAY(INDEX) = N) GOTO 410: ON (ARRAY(INDEX) >N) GOTO 420:NT = NT +1: NEXT INDEX
410 PRINT : PRINT "IT HAS BEEN DETERMINED ON ";: INVERSE : PRINT NT;: NORMAL : PRINT " TRIES": PRINT "THAT THE NUMBER ";: INVERSE : PRINT N;: NORMAL : PRINT " OCCUPIES POSITION ": INVERSE : PRINT INDEX;: NORMAL : PRINT " IN THE ARRAY": PRINT : GOTO 430
420 PRINT : PRINT "IT HAS BEEN DETERMINED ON ";: INVERSE : PRINT NT;: NORMAL : PRINT " TRIES": PRINT "THAT THE NUMBER ";: INVERSE : PRINT N;: NORMAL : PRINT " IS NOT IN THE ARRAY": PRINT
430 PRINT "PRESS <";: INVERSE : PRINT "RETURN";: NORMAL : PRINT "> TO CONTINUE: ";: POKE -16368,0: GET K$: RETURN